package com.douqu.game.core.config;

import com.douqu.game.core.config.common.GoodsData;
import com.douqu.game.core.entity.GameObject;
import com.douqu.game.core.util.LoadUtils;
import com.douqu.game.core.util.LogUtils;


/**
 * @author wangzhenfei
 *         2017-12-04 14:38
 */
public class DailySignRewardConfig extends GameObject{
    /** 签到奖励**/
    public GoodsData[] reward;

    /**双倍的最低vip等级**/
    public int doubleVipLevel;

    @Override
    public boolean check()
    {
        if(reward == null)
        {
            LogUtils.error("DailySignConfig check reward is null -> id:" + id + " name:" + name);
            return false;
        }
        return true;
    }

    @Override
    public boolean setVariable(String key, String value)
    {
         if("reward".equals(key))
        {
            reward = LoadUtils.loadGoodDataToArray(key, value);
            return LoadUtils.checkGoods(reward, this.getClass(), key, id);
        }
        else
            return super.setVariable(key, value);
    }

}
